package org.sxm.cloud.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.sxm.cloud.dto.product.ProductDTO;

/**
 * 产品服务
 */

@FeignClient(name = "product-svc")
public interface ProductClient {

    /**
     * 根据产品ID查询产品信息
     *
     * @param id
     * @return
     */
    @GetMapping("/product/{id}")
    ProductDTO getProduct(@PathVariable("id") Integer id);

    /**
     * 扣减产品库存
     *
     * @param id
     * @param num
     * @return
     */
    @PostMapping("/product/reduse")
    String reduseProduct(@RequestParam("id") Integer id, @RequestParam("num") Integer num);
}
